import request from "../utils/request";

export default {
    // 获取用户的收藏夹列表
    getUserFavorites(data) {
        return request({
            url: `/user/api/favorites/getUserFavorites`,
            method: "post",
            data
        });
    },

    // 获取收藏夹中收藏的文章信息
    getFavoritesArticle(favoritesId) {
        return request({
            url: `/user/api/favorites/getFavoritesArticle`,
            method: "get",
            params: {
                favoritesId
            }
        });
    },

    // 用户是否收藏该文章
    isFavorite(articleId) {
        return request({
            url: `/user/favorites/isFavorite`,
            method: 'GET',
            params: {
                articleId
            }
        })
    },

    // 创建收藏夹
    createFavorites(data) {
        return request({
            url: `/user/favorites/createFavorites`,
            method: "post",
            data
        });
    },

    // 获取用户所有的收藏夹
    getUserAllFavorites(articleId) {
        return request({
            url: `/user/favorites/getUserAllFavorites`,
            method: "get",
            params: {
                articleId
            }
        });
    },

    // 收藏文章
    favoriteArticle(data) {
        return request({
            url: `/user/favorites/favoriteArticle`,
            method: "post",
            data
        });
    },

    // 删除收藏夹
    deleteFavorites(favoritesId) {
        return request({
            url: `/user/favorites/deleteFavorites`,
            method: "get",
            params: {
                favoritesId
            }
        });
    },

    // 获取收藏夹信息
    getFavoritesInfo(favoritesId) {
        return request({
            url: `/user/api/favorites/getFavoritesInfo`,
            method: "get",
            params: {
                favoritesId
            }
        });
    },

    // 分页获取收藏夹中的文章信息
    favoritesArticlePageList(data = {}) {
        return request({
            url: `/user/api/favorites/favoritesArticlePageList`,
            method: "POST",
            data
        });
    },

    // 编辑收藏夹信息
    updateFavorites(data = {}) {
        return request({
            url: `/user/favorites/updateFavorites`,
            method: "POST",
            data
        });
    },


}